
@echo off
cls

setlocal enabledelayedexpansion

set src=..\..\..\external\sfml\examples\opengl\resources
set insert=resources

rem =======================================================
if not exist %src% (
    echo ERROR:  %src% not exists
    echo ERROR:  operation abort
    exit/b
)
rem =======================================================

if not "%insert%" == "" ( 

    if not exist %insert% (
        echo creade folder '%insert%'
        md %insert%
    ) ELSE ( echo create folder is not required )
    set insert=%insert%\

) ELSE ( 
    echo create folder is not required 
)
rem ================== directories ========================

for /D %%a  in (%src%\*) do (
rem     echo  current: %%~na
     set src_dir=%%a
     set dst_dir=%~dp0%insert%%%~na%

     if exist !dst_dir! ( echo !src_dir! already linked ) ELSE (
         echo src: !src_dir! 
         echo dst: !dst_dir!
         echo.
         mklink /j !dst_dir! !src_dir!
     )
)
                                   
rem ===================== files ===========================

for  %%a  in (%src%\*) do (
rem     echo  current: %%~na
     set src_file=%%a
     set dst_file=%~dp0%insert%%%~na%%~xa

     if exist !dst_file! ( echo !src_file! already linked ) ELSE (
rem         echo src: !src_file! 
rem         echo dst: !dst_file!
rem         echo.
         mklink /h !dst_file! !src_file!
     )
 )
rem ====================== end ============================


